//
//  SYCYHeaderView.m
//  SanYiTeaching
//
//  Created by 郑浩然 on 2019/4/22.
//  Copyright © 2019年 SanYi. All rights reserved.
//

#import "SYCYHeaderView.h"
#import "SYFuntionHeaderView.h"


@interface SYCYHeaderView ()
@property (strong, nonatomic) SYFuntionHeaderView *headerViewKS;//开始
@property (strong, nonatomic) SYFuntionHeaderView *headerViewJS;//结束
@property (strong, nonatomic) UILabel *headerLab;
@property (strong, nonatomic) UILabel *nameLab;//姓名
@property (strong, nonatomic) UILabel *gonghaoLab;//工号
@property (strong, nonatomic) UILabel *telLab;//电话
@property (strong, nonatomic) UILabel *dateLab;//加入日期
//@property (strong, nonatomic) SYTopView *topView;

@end


@implementation SYCYHeaderView

- (instancetype)init {
    self = [super init];
    if (self) {
        [self initSubView];
    }
    return self;
}

- (void)initSubView {
    [self addSubview:self.headerLab];
    [self.headerLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.mas_centerX);
        make.top.equalTo(self.mas_top).offset(30);
    }];
    CGFloat height = 40;
    CGFloat width = 330;
    //开始日期
    [self addSubview:self.headerViewKS];
    [self.headerViewKS mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.headerLab.mas_bottom).offset(15);
        make.left.equalTo(self.mas_left).offset(70);
        make.width.mas_equalTo(width);
        make.height.mas_equalTo(height);
    }];
    //结束日期
    [self addSubview:self.headerViewJS];
    [self.headerViewJS mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.headerViewKS.mas_centerY);
        make.left.equalTo(self.mas_centerX).offset(70);
        make.width.mas_equalTo(width);
        make.height.mas_equalTo(height);
    }];
    //标题头
    [self addSubview:self.topView];
    [self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(14);
        make.right.equalTo(self.mas_right).offset(-14);
        make.bottom.equalTo(self.mas_bottom);
        make.height.mas_equalTo(40);
    }];
    [self addSubview:self.nameView];
    [self.nameView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(self);
        make.top.equalTo(self.headerViewKS.mas_bottom).offset(15);
        make.height.mas_equalTo(50);
    }];
    
    CGFloat w = 150;
    //姓名
    [self.nameView addSubview:self.nameLab];
    [self.nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(self.headerViewKS.mas_leading).offset(14);
        make.top.equalTo(self.headerViewKS.mas_bottom).offset(15);
        make.width.mas_equalTo(w);
    }];
    //工号
    [self.nameView addSubview:self.gonghaoLab];
    [self.gonghaoLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.nameLab.mas_centerY);
        make.left.equalTo(self.nameLab.mas_right).offset(20);
        make.width.mas_equalTo(w);
    }];
    //电话
    [self.nameView addSubview:self.telLab];
    [self.telLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.nameLab.mas_centerY);
        make.left.equalTo(self.gonghaoLab.mas_right).offset(20);
        make.width.mas_equalTo(w);
    }];
    //加入日期
    [self.nameView addSubview:self.dateLab];
    [self.dateLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.nameLab.mas_centerY);
        make.left.equalTo(self.telLab.mas_right).offset(20);
        make.width.mas_equalTo(w+100);
    }];
}
#pragma mark - set
- (UILabel *)headerLab {
    if (!_headerLab) {
        _headerLab = [UILabel titleColour:TITLECOLOR
                               titleFount:14
                                 pingfang:@"PingFang-SC-Medium"
                                alignment:NSTextAlignmentCenter
                                titleLine:1];
        _headerLab.text = @"吴亚茹2019师训小组";
    }
    return _headerLab;
}
//开始日期
- (SYFuntionHeaderView *)headerViewKS {
    if (!_headerViewKS) {
        _headerViewKS = [[SYFuntionHeaderView alloc] init];
        _headerViewKS.titleLab.text = @"开始日期: ";
        _headerViewKS.textField.hidden = YES;
    }
    return _headerViewKS;
}
//结束日期
- (SYFuntionHeaderView *)headerViewJS {
    if (!_headerViewJS) {
        _headerViewJS = [[SYFuntionHeaderView alloc] init];
        _headerViewJS.titleLab.text = @"结束日期: ";
        _headerViewJS.textField.hidden = YES;
    }
    return _headerViewJS;
}
//姓名
- (UILabel *)nameLab {
    if (!_nameLab) {
        _nameLab = [UILabel titleColour:TITLECOLOR
                               titleFount:12
                                 pingfang:@"PingFang-SC-Regular"
                                alignment:NSTextAlignmentLeft
                                titleLine:1];
        _nameLab.text = @"姓名：李春艳/女";
    }
    return _nameLab;
}
//工号
- (UILabel *)gonghaoLab {
    if (!_gonghaoLab) {
        _gonghaoLab = [UILabel titleColour:TITLECOLOR
                             titleFount:12
                               pingfang:@"PingFang-SC-Regular"
                              alignment:NSTextAlignmentLeft
                              titleLine:1];
        _gonghaoLab.text = @"工号：E0142";
    }
    return _gonghaoLab;
}
//电话
- (UILabel *)telLab {
    if (!_telLab) {
        _telLab = [UILabel titleColour:TITLECOLOR
                                titleFount:12
                                  pingfang:@"PingFang-SC-Regular"
                                 alignment:NSTextAlignmentLeft
                                 titleLine:1];
        _telLab.text = @"电话：13014518277";
    }
    return _telLab;
}

- (UILabel *)dateLab {
    if (!_dateLab) {
        _dateLab = [UILabel titleColour:TITLECOLOR
                            titleFount:12
                              pingfang:@"PingFang-SC-Regular"
                             alignment:NSTextAlignmentLeft
                             titleLine:1];
        _dateLab.text = @"加入日期：2019-03-20 19:17";
    }
    return _dateLab;
}
- (SYTopView *)topView {
    if (!_topView) {
        _topView = [[SYTopView alloc] init];
        _topView.titleLab.text = @"听课信息";
        _topView.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"];

    }
    return _topView;
}

- (UIView *)nameView {
    if (!_nameView) {
        _nameView = [[UIView alloc] init];
    }
    return _nameView;
}

@end
























